package com.kaiwukj.android.ufamily.mvp.ui.page.home.message.add;

import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.kaiwukj.android.ufamily.R;
import com.kaiwukj.android.ufamily.mvp.http.entity.result.ChatSearchGroupResult;

import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;

public class GroupResultAdapter extends BaseQuickAdapter<ChatSearchGroupResult, BaseViewHolder> {
    public GroupResultAdapter() {
        super(R.layout.item_chat_search_group_result, new ArrayList<>());
    }

    @Override
    public long getItemId(int position) {
        return getItem(position).getId();
    }

    @Override
    protected void convert(@NotNull BaseViewHolder holder, ChatSearchGroupResult result) {
        ImageView ivAvatar = holder.getView(R.id.iv_avatar);
        Glide.with(getContext())
                .load(result.getTopicImg())
                .into(ivAvatar);
        holder.setText(R.id.tv_name, String.format("#%s", result.getTopicTitle()));
        holder.setText(R.id.tv_desc, result.getTopicDetail());
    }
}
